<?
	session_start();
	include('conn.php');	
	$num = $_REQUEST["dataset"];
	$opt = $_REQUEST["q"];
	$user=$_SESSION['username'];
	
	switch($opt){
		case 'c':			
			$qry = "insert into cardTable(cardno,enteredby,entrydt,status,flag) values('$num','$user','".date('Y-m-d')."','0','free');";		
			echo "<br> $qry <br>";
			$res = mysql_query($qry);		
			break;
		
		case 'u':
			$id = $_REQUEST['id'];		
			$qry = "update cardTable set cardno = '$num', modifiedby = '$user', modifieddt = '".date('Y-m-d')."' where id='$id';";	
			echo "<br> $qry <br>";
			$res = mysql_query($qry);		
			break;
			
		case 'd':
			$id = $_REQUEST['id'];			
			$qry = "update cardTable set status='9' where id='$id';";		
			echo "<br> $qry <br>";
			$res = mysql_query($qry);		
			break;
		
		default:
			echo "No option selected";
	}
?>